package com.feng.modules.core.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.RowBounds;

import com.feng.modules.core.dao.ICommonDao;
import com.feng.modules.core.util.BaseUtils;
import com.feng.modules.page.MyBatisSql;

public class CommonDaoImpl extends BaseDao implements ICommonDao{

    public Map<String,Object> getPageList(String commonMybatisId, Map<String, Object> param, RowBounds rowBound) {
	List<?> list=this.getSqlSessionTemplate().selectList(commonMybatisId, param, rowBound);
	MyBatisSql mybatisSql=BaseUtils.getMyBatisSql(commonMybatisId, param, this.getSqlSessionTemplate().getSqlSessionFactory());
	int  count=this.getJdbcTemplate().queryForInt(mybatisSql.getCountSql());
	Map<String,Object> reMap=new HashMap<String,Object>();
	reMap.put("Rows", list);
	reMap.put("count", count);
	return reMap;
    }

    @SuppressWarnings("unchecked")
    public List<Map<String,Object>> getList(String string, Map<String, Object> param) {
	return (List<Map<String,Object>>)this.getSqlSessionTemplate().selectList(string, param);
    }


}
